// Author: Domien Nowicki

#ifndef COLORCRAZY_H
#define COLORCRAZY_H

#include <QtGui/QMainWindow>
#include <string>
#include "ui_colorcrazy.h"
#include "Map.h"
#include "Highscore.h"
#include "PropertiesDialog.h"
#include "SingleGameWidget.h"
#include "VersusGameWidget.h"

// The main window class
class ColorCrazy : public QMainWindow
{
    Q_OBJECT

public:
	// Constructor
    ColorCrazy(QApplication *a, QWidget *parent = 0, Qt::WFlags flags = 0);

	// Destructor
    ~ColorCrazy();

private:
	// Helper functions
	void SetMapLoaded();
	void SetGameCleared();
	void SetGameStarted(Game* game);
	std::string SingleGameFilename(const std::string& mapFilename);
	std::string VersusGameFilename(const std::string& mapFilename);

	// The ui
    Ui::ColorCrazyClass ui;

	// State variables
	bool mapLoaded, gameLoaded;
	Map map;
	Highscore highscoreSingle;
	Highscore highscoreVersus;
	Properties properties;

	SingleGameWidget *singleGame;
	VersusGameWidget *versusGame;

private slots:
	void OnPropertiesAccepted(const Properties& properties);
	void OnGameStarted(Game* game);
	void OnGameStopped();

	// Auto connected slots
	void on_actionAbout_activated();
	void on_actionLoad_activated();
	void on_actionClear_activated();
	void on_actionQuit_activated();
	void on_actionColorMap_activated();
	void on_actionHint_activated();
	void on_actionSingleGame_activated();
	void on_actionVsComputer_activated();
	void on_actionProperties_activated();
	void on_actionSingleHighscores_activated();
	void on_actionVersusHighscores_activated();
};

#endif // COLORCRAZY_H
